package org.deschutter.constants;

import java.math.BigDecimal;

/**
 * User: Berten De Schutter
 * Date: 01-Jul-2009
 * Time: 14:58:31
 */
abstract public class Formulae implements Config {
    /*
    Light indicates that the planet has less then 34 of its resources in the given production area.
    Medium indicates that the planet has between 34 and 66 percent of its resources in a given area of production.
    Heavy indicates that the planet has greater then 66 percent of its total resources in a given area of production.
     */
    public static final BigDecimal light = new BigDecimal(0.34);
    public static final BigDecimal medium = new BigDecimal(0.67);
    public static final BigDecimal high = new BigDecimal(1);

    public static BigDecimal getResourcesInProduction(String level, BigDecimal totalProduction) {
        BigDecimal result;

        if (level.equals("Light")) {
            result = light.multiply(totalProduction);


            return result.setScale(0, BigDecimal.ROUND_HALF_EVEN);

        } else if (level.equals("Medium")) {
            result = medium.multiply(totalProduction);


            return result.setScale(0, BigDecimal.ROUND_HALF_EVEN);
        } else if (level.equals("High")) {
            result = high.multiply(totalProduction);


            return result.setScale(0, BigDecimal.ROUND_HALF_EVEN);
        } else {
            return BIGDECIMAL_ZERO;
        }
    }
}
